package com.yi.apipassenger.service;

import com.yi.apipassenger.remote.ServicePriceClient;
import com.yi.internalcommon.dto.ResponseResult;
import com.yi.internalcommon.request.ForecastPriceDTO;
import com.yi.internalcommon.responese.DirectionResponse;
import com.yi.internalcommon.responese.ForecastPriceResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

@Service
@Slf4j
public class ForecastPriceService {
    @Autowired
    private ServicePriceClient priceClient;
    /**
     * 根据出发地和目的地 计算预估价格
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */
    public ResponseResult forecastPrice(String depLongitude,String depLatitude, String destLongitude,String destLatitude,String cityCode,String vehicleType ){
        log.info("调用计价服务，计算价格");
        ForecastPriceDTO forecastPriceDTO = new ForecastPriceDTO();
        forecastPriceDTO.setDepLatitude(depLatitude);
        forecastPriceDTO.setDepLongitude(depLongitude);
        forecastPriceDTO.setDestLatitude(destLatitude);
        forecastPriceDTO.setDestLongitude(destLongitude);
        forecastPriceDTO.setCityCode(cityCode);
        forecastPriceDTO.setVehicleType(vehicleType);
        ResponseResult<ForecastPriceResponse> result = priceClient.forecastPrice(forecastPriceDTO);
        return  result;
    }

}
